#!/usr/bin/env bash

if [[ "$(uname -s)" = Darwin ]]; then
    osascript <<EOF
    display notification "git-ctags: `pwd`" with title "post-checkout"
EOF
fi

~/bin/git-ctags &>/dev/null &

if [[ $1 != 0000000000000000000000000000000000000000 ]] \
    && [[ $3 -eq 1 ]] \
    && git diff --name-only $1 $2 | egrep -q '^Gemfile|\.gemspec$' \
    && command -v bundle &>/dev/null
then
    exec bundle
fi
